import { DataTypes } from 'sequelize';
import { Migration } from '../umzug';

export const up: Migration = async ({ context: sequelize }) => {
  await sequelize.getQueryInterface().createTable('conclusions', {
    id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true },
    uuid: { type: DataTypes.STRING(36), unique: true },
    name: { type: DataTypes.STRING(255) },
    fk_classification: {
      type: DataTypes.INTEGER,
      references: {
        model: {
          tableName: 'classifications',
        },
        key: 'id',
      },
    },
    created_at: { type: DataTypes.DATE },
    updated_at: { type: DataTypes.DATE },
  });
};

export const down: Migration = async ({ context: sequelize }) => {
  await sequelize.getQueryInterface().dropTable('conclusions');
};
